package adv7;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

public class FileSendThread extends Thread {
	private Socket s;

	public FileSendThread(Socket s) {
		this.s = s;

	}

	@Override
	public void run() {
		try {
			System.out.println("准备发文件给：" + s);
			FileInputStream fin = new FileInputStream("E:\\BaiduNetdiskDownload\\job-salary.png");
			byte[] b = new byte[fin.available()];
			int len = fin.read(b);
			fin.close();
			// InputStream in = s.getInputStream();
			OutputStream out = s.getOutputStream();
			out.write(b, 0, len);
			System.out.println("对象发送" + s + " 完成");
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				s.close();
			} catch (Exception e) {
				// TODO 自动生成的 catch 块
				// e.printStackTrace();
			}
		}

	}
}
